<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>

    <transition name="hello1">
      <h2 v-show="isShow">你好1</h2>
    </transition>

    <transition name="hello2">
      <h2 v-show="isShow">你好2</h2>
    </transition>
    
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
  }
  h2 {
    background-image: linear-gradient(45deg,red,yellow,pink,green);
    box-shadow: 0 0 5px;
  }
  @keyframes atguigu {
    from{
      transform: translateX(0);
    }
    to{
      transform: translateX(-100%);
    }
  }
  .hello1-leave-active{
    animation: atguigu 5s linear;
  }
  .hello1-enter-active{
    animation: atguigu 5s linear reverse;
  }
  .hello2-leave-active{
    animation: atguigu 1s linear;
  }
  .hello2-enter-active{
    animation: atguigu 1s linear reverse;
  }
</style>